<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>北京联合大学</title>
</head>
<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- <link rel="stylesheet" href="https://at.alicdn.com/t/font_835526_xufba1hg66.css"> -->
<link rel="stylesheet" href="https://at.alicdn.com/t/font_835526_uzbxo9d25is.css">
<link rel="stylesheet" href="../../css/Initialization.css">
<link rel="stylesheet" href="../../css/commen.css">
<link rel="stylesheet" href="../../css/UploadResults.css">
<style>
    .teacherHuiZong .table a{
            color: #0156a8!important;
    }
    .teacherHuiZong .table a:active{
            color: #0156a8!important;
    }
    .teacherHuiZong .table a:hover{
            color: #0156a8!important;
    }
    .teacherHuiZong .table a:visited{
            color: #0156a8!important;
    }
</style>
<body>
<div id="content">
    <div class="initer">
            <!-- 具体内容 -->
            <div class="bread">
                <div class="plain">管理配置</div>
                <div class="plain">
                    <i class="iconfont icon-right"></i>
                </div>
                <div class="plain current">学年课程管理</div>
                <div class="center-button">
                    <a href="addgrade">新建学年</a>
                </div>
            </div>
            <div class="teacherlookwork teacherlookteam teacherHuiZong">
                <table class="table">
                    <tr class="tabletitle">
                        <!--td>ID</td-->
                        <td>序号</td>
                        <td>名称</td>
                        <td>操作</td>
                    </tr>
                    <tr th:each="item : ${departs}">
                        <!--td th:text="${item.id}">ID</td-->
                        <td th:text="${item.sort}">序号</td>
                        <td th:text="${item.departname}">名称</td>
                        <td>
                            <a th:href="@{updategrade(id=${item.getId()})}" style="color: #0156a8;">编辑</a>&nbsp;&nbsp;|&nbsp;&nbsp;
                            <a href="javascript:void(0)" th:onclick="'javascript:deleteDepart(\''+${item.getId()}+'\')'" style="color: #0156a8;">删除</a>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
</div>
<script src="../../js/jquery-3.4.1.min.js"></script>
<script src="../../js/commen.js"></script>
<script>
    function deleteDepart(id){
        if (confirm("是否确定删除？")) {
            $.ajax({
                type : "POST",
                url : "delete",
                data : {departid: id},
                dataType : "json",
                success : function(json) {
                    alert(json.result);
                    if(json.state == success){
                        location.reload();
                    }
                },
                error:function(msg){
                    alert("程序出错，请联系管理员");
                }
            });
        }
    }
</script>
</body>
</html>

